﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Web;
using System.Windows.Forms;

namespace wlwlatex {
	public partial class LaTeXInput : Form {
		// Constructor
		public LaTeXInput() {
			InitializeComponent();
		}

		// public properties
		public string ResultHTML {
			get { return m_result_gchart_html; }
		}

		// data members
		string m_result_gchart_html = "";

		private void buttonOK_Click(object sender, EventArgs e) {
			// get original latex string, and encode it
			string raw_latex = textBoxLaTeX.Text;
			string encoded_str = HttpUtility.UrlEncode(raw_latex);
			string gchart_url = "http://chart.googleapis.com/chart?cht=tx&chl=" + encoded_str;

			m_result_gchart_html = String.Format("<p><img src=\"{0}\" /></p>", gchart_url);

			this.DialogResult = DialogResult.OK;
		}
	}
}
